package com.example.chapter04_excersise_baitap4;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
/*
 *  Chapter04 : 
 *  Bài tập : 4 
 *  Mục đích : Thực hành việc tạo màn hình Splash Sreen
 * 
 */
public class SplashSrceen extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
     
        setContentView(R.layout.activity_splashsreen);
        
        Thread d = new Thread(){	
       	
       	  @Override
		public void run (){
       		  try {
       			 sleep(3000); 
       			Intent intent = new Intent(getApplicationContext(),MainActivity.class);   
       			  startActivity(intent);
       		} catch (Exception e) {
       			// TODO: handle exception
       		}
       		 
       	  }
       };
       d.start();
    }


    
}

class ChoChut extends Thread{
	 Intent intents = null;
	 Context start = null;
	 public ChoChut(Intent intents,Context start){
		 this.intents = intents;
		 this.start = start;
	 }
	  @Override
	public void run (){
		  try {
			  sleep(3000);
			  Intent  intent = intents;
			  start.startActivity(intent);
		} catch (Exception e) {
			// TODO: handle exception
		}
		 
	  }
}